﻿using MediatR;
using S.EarTag.Domain.Dto;
using S.EarTag.Domain.Model;
using S.EarTag.Infrastructure.Repository.Interface.IEarTagRepository;
using S.EarTag.Read.API.Mediator.MediatorCommand.EarTagCommand;

namespace S.EarTag.Read.API.Mediator.MediatorCommandHandler.EarTagCommandHandler
{
    public class EarTagSeachCommandHandler : IRequestHandler<EarTagSeachCommand, List<EarTagModelDto>>
    {
        private readonly IEarTagModelRepository _earTagModelRepository;
        public EarTagSeachCommandHandler(IEarTagModelRepository earTagModelRepository)
        {
            _earTagModelRepository= earTagModelRepository;  
        }
        /// <summary>
        /// 条件查询根据耳标状态为未使用的状态查询显示耳标
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<List<EarTagModelDto>> Handle(EarTagSeachCommand request, CancellationToken cancellationToken)
        {
            return await _earTagModelRepository.GetEarTagModels();
        }
    }
}
